#!/bin/bash
if [ "$(uname)" != "AIX" ]; then echo Not AIX; exit 1; fi
BAENV=$(dirname `which $0`)/loadenv.sh
if [ -f $BAENV ]; then . $BAENV; else echo "No env library ($BAENV)"; exit 1; fi
LOG=$LOGDIR/kerberos_install_`uname -n`.txt
cd /central/aixcdrom/inhouse/AIX_V6.1_Expansion_Pack_102009/installp/ppc
echo "Installing pre-requisite filesets:"
if ! /usr/lib/instl/sm_inst installp_cmd -a -Q -d '.' -f 'krb5.client ALL @@I:krb5.client _all_filesets,krb5.lic ALL @@I:krb5.lic _all_filesets' -N -g -X -G -Y
then
	read -p "Something failed, do you want to continue? [y/n]: "
	if [ "$REPLY" != "y" ]; then exit; fi
fi	
if [ -f /etc/krb5/krb5.conf ]; then bk /etc/krb5/krb5.conf; fi
if [ -f /usr/lib/security/methods.cfg ]; then bk /usr/lib/security/methods.cfg; fi
cp /central/depot/files/krb5.conf /etc/krb5/krb5.conf
cp /central/depot/files/methods.cfg /usr/lib/security/methods.cfg
echo
/bin/echo "Changing authentication agent: \c"
if chauthent -k5 -std; then echo ok; fi
echo
echo "Listing agents:"
lsauthent
bk /etc/security/user
echo
/bin/echo "Changing default SYSTEM: \c"
if chsec -f /etc/security/user -s default -a SYSTEM="KRB5A or compat" -a registry="files"; then echo ok; fi
